#include<vector>
#include<queue>
using namespace std;

struct TreeNode {
    TreeNode* left;
    TreeNode* right;
    int val;
    TreeNode() :left(nullptr),right(nullptr),val(0){}
};
class Solution {
public:
    vector<vector<int>> decorateRecord(TreeNode* root) {
        vector<vector<int>> ret;
        queue<TreeNode*> q;
        if (root)q.push(root);
        while (q.size()) {
            int len = q.size();
            vector<int> level;
            while (len--) {
                auto t = q.front();
                q.pop();
                level.push_back(t->val);
                if (t->left)q.push(t->left);
                if (t->right)q.push(t->right);
            }
            ret.push_back(level);
        }
        return ret;
    }
};